<template>
  <div class="comment-wrapper">
  <div class="items">
    <div class="item"  v-for="(item,index) in pinglun" :key="'pinglun'+index">
      <div class="left">
        <img :src="item.user.avatarUrl" alt="">
      </div>
      <div class="right">
        <div class="top">
          <span class='user'>{{ item.user.nickname}}</span>
          <span class='content'>{{ item.content }}</span>
        </div>
        <div class="bottom">
          <div class="time">2016年9月18日</div>
          <div class="like-wrapper">
              <span>👍</span>{{ item.likedCount }}
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
</template>
<script>
export default {
data(){
  return {
    pinglun:[]
  }
},
async created(){
  if(!this.$route.params.id){
    alert('未检出歌曲id信息')
    // 后退一步
    window.history.back(-1)
    return
  }
  let src=await this.$axios.get("/comment/hot?type=0&id=" + this.$route.params.id)
  console.log(src)
  this.pinglun=src.data.hotComments
  // this.mingzi=src.data.hotComments[1].user.nickname
}
}
</script>

<style scoped>
@import "@/assets/css/comment.css";
</style>